<?php
namespace app\common\model;
use think\Db;
use think\Model;
/**
 * 邀请好友
 * @author lcx
 * @date 2018-08-20
 */
class InvitationRecord {
    // 表名
    protected $dbName = 'invitation_record';

    // 列表查询
    public function getAll($where, $join, $page, $pageSize, $field, $order) {
        $result = Db::name($this->dbName)->where($where)
                ->join($join)
                ->field($field)
                ->page($page, $pageSize)
                ->order($order)
                ->select();
        return $result;
    }

    // 数量查询
    public function getCount($where, $join, $dbName) {
        $result = Db::name($dbName)
                ->where($where)
                ->join($join)
                ->count();
        return $result;
    }

    // 单个查询
    public function getOne($where, $join, $field, $dbName) {
        $result = Db::name($dbName)
                ->where($where)
                ->join($join)
                ->field($field)
                ->find();
        return $result;
    }

    // 添加一条数据
    public function add($data)
    {
        $result = Db::name($this->dbName)->insertGetId($data);
        return $result;
    }
}
